#ifndef Object_H
#define Object_H
#include <SDL.h>
#include <SDL_image.h>
#include "MyRectangle.h"
#include "defines.h"
class Game;

class Object{

protected:
	SDL_Surface *image;/*Kieu Du Lieu cua thu vien SDL*/
	int type ;
	SDL_Surface *screen;/*Kieu Du Lieu cua thu vien SDL*/
	Game *game;
	double scaleRate;
	int speed ;
	Uint32 lasttime ;
	
public:
	MyRectangle rect;
	enum KindOfObject{
		kObject,
		kFence,
		kChicken,
		kDuck,
		kGoose,
		kEgg,
		kBasket,
		kShit,
		kPoulty
	};
	
	Object(SDL_Surface *screen = NULL/*Kieu Du Lieu cua thu vien SDL*/);
	Object(Game *game, const char *pathImage, double scaleRate);
	~Object() {SDL_FreeSurface( image );}
	void setScreen(SDL_Surface *screen = NULL/*Kieu Du Lieu cua thu vien SDL*/){ this ->screen = screen; }
	void setPositions(int x, int y){this ->rect.sdlRect.x = x ; this ->rect.sdlRect.y = y;}
	void setXPosition(int x){ setPositions(x, rect.sdlRect.y); }
	void setYPosition(int y){ setPositions(rect.sdlRect.x, y);}
	bool checkColision(const MyRectangle &rect);
	bool checkColision(Object *obj);
	void loadImage(const char * pathImage, double scaleRate = 1.0);
	virtual void draw();
	virtual void handleInput(){};
    virtual void update();
	void moveLeft() ;
	void moveRight();
	void moveDown();
	void setType(int type){this ->type = type; }
	void setRectangle(const MyRectangle &rect);
	void setSpeed(int speed){this ->speed = speed;}
	
};
#endif